Skip to content

Preserve producer-bound heartbeat Turn identities - #8232

Merged
loopx-agent merged 2 commits into
mainfrom
codex/bound-heartbeat-turns-20261107
Nov 7, 2026
Merged

loopx-agent merged 2 commits into
mainfrom
codex/bound-heartbeat-turns-20261107

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

已有 worker 会在生成 heartbeat 提示前提供本轮 Turn 时间戳,但 full/compact/brief/thin 提示仍要求模型在唤醒时替换一个已经不存在的占位符。这里在现有绑定 owner 实际完成替换后,移除这条已经由生产者履行的指令;具体赋值、独立 guard、重试时的原身份和结算来源保留。未绑定的可复用唤醒模板逐字不变,不改历史正文、读取义务、权限、停止或预算。

当前 head 0836bd92c7ad75a40ec9d2ab3929cc92133a3efa,基线 ac62962255322cd80a5b701a4187c6f47bc17d8c。只改三个文件,+34 / −1,不依赖整体 C1。相同修复同步在 #7430;这是可独立审阅的现有行为修复,不宣称父 PR 已因此缩小。

测试中的 refresh 同时显式以其实际 disposable project 为 cwd,避免源码 checkout 掩盖调用方的工作区前提;生产工作区守卫没有改变。

验证:

  • 相同四个模块在源码和全新隔离安装环境中分别完整 172 passed,覆盖原 File/SQLite、guard/selection/重入、原捕获、重放、一次写回和一次扣额,以及既有预算和溢出负例。模型与外部 provider 为合成实现。
  • 八个模式/宿主语法反事实先在原 main 失败、修复后通过;Windows 语法为模拟,未声称 Windows 安装资格。36 个实际 builder 对照中,16 个未绑定默认/off 输出逐字一致,16 个绑定输入只移除已履行的指令,四个既有 captured-envelope 输出逐字一致;命令和其它生成字段保留。
  • 最初源码和安装各 164 passed / 8 failed,八处均因新增测试误用了 C1 的压缩措辞,在产品修复断言前失败。改回 main 原有语义表述后,重新取得八个真正的基线反例,并从新目录完整重跑上述两组 172;产品源码及 wheel 未改变,未拼接局部重放为全绿。原失败保留。
  • 默认 17 入口 Mypy、三个改动路径 Ruff 和有限语义 advisory 通过;1,816 个受跟踪产品源、1,815 个 Core 分发源及 24 个可选 provider 文件与冻结实测、当前提交和隔离安装逐字一致。五个已观测 Python 进程、1,175 个 Core 模块及六处子进程来源无已观测 checkout Core 导入,部分子进程覆盖审计环境,不声称覆盖全部进程。

精确当前 head 的 quick 检查为 6 个直接检查、3 个选择检查机械通过;总体仍因 quality_receipt_missing 而 hold,没有自造质量回执,也未声称独立批准或 merge readiness。

未查询或手动触发 CI,未全局安装、发布或合并。这一修复消除提示中的身份歧义;测试和逐字读回不证明真实模型采用、记忆保留或完整任务净收益。

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent, gpt-6.1-sol, OpenAI; runtime_reported; reasoning_effort=max

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

未发现阻塞问题;结论绑定 0836bd92c7ad75a40ec9d2ab3929cc92133a3efa。独立检查支持这处提示修复,未把作者测试当作验收。

动机 / Motivation

已绑定本轮时间戳的 heartbeat worker 会把生成的提示交给执行模型。
旧提示已写入具体 Turn,却仍要求每次唤醒替换时间戳;修复后保留该具体身份与独立 guard,仅删除已由生产者履行的替换指令。
未绑定模板逐字不变,绑定输出只移除这段指令;读取、权限、Stop 和原身份结算义务继续保留。
本改动不修改 scheduler、历史回执、权限或预算,也不认证真实模型采用和长程净收益。

改动思路 / Approach

现有 binder 已掌握具体身份与模板的区别,在这一处移除已履行指令可避免四套 renderer 分别维护绑定规则。
本 PR 只修复已绑定提示的指令矛盾,不修改身份生成、调度和结算状态机。
调用链仍是 builder 选择宿主正文、既有 binder 写入原始身份、worker 执行独立 guard,再按本轮动态契约验证和结算。最强反对理由是删除整句可能连带丢失重试义务;完整输出比较证明,具体赋值和 guard 仍分行,原身份与 effect id 结算、读取、权限及停止指令均保留。无需增加状态、复制四套 renderer,或把这项修复与 #7430 整体重构捆绑。

具体改动 / Changes

依据改动前的 docs/heartbeat-automation-prompt.md,规范版本为 ac62962255322cd80a5b701a4187c6f47bc17d8c。文档未给这些段落编号,以下为本评审的定位标签:HB-bind-before-guard 对应唤醒时先绑定原 Turn 再执行 guard;HB-original-settlement 对应完整必读来源与原身份的动态结算。两项均已实现。

关键代码讲解

  • bind_exact_turn_settlement_task_body:turn_instance_id=None 直接保留模板;只有实际替换占位赋值后,才删除一次原有规则。已有捕获正文不会因此被重写,原动态结算路径和 exact identity/effect id 尾句仍在。
  • build_heartbeat_prompt:四种 renderer 继续共用这一 binder,传入的仍是已验证的原始身份。没有第二个时间戳或权限 owner。

全部差异为三个文件 +34/-1,其中生产代码仅新增五行;另两处为八组宿主/模式反例和实际临时项目 cwd 修正,未降低生产工作区守卫。

对主干的风险 / Risks

独立 PASS:四个完整模块共 172 项、零跳过;真实合成 File/SQLite worker 覆盖 guard、选择重入、捕获、回放、一次写回和一次扣额。另用同一套 32 组 builder 输入比较两版:16 个未绑定完整对象逐字一致,16 个绑定正文只少原规则,命令与其他字段保留;预算字符计数随正文缩短,未修改阈值。独立反例 oracle 在 base 的 16 个绑定输入失败,head 全部通过。

语义与 CI 对齐

完整比较覆盖被删除指令的 actor、触发条件、顺序、重试身份、读取、权限、Stop 与结算来源。此处复用既有 vocabulary,不增加共享状态或业务领域分类。quick premerge 的六项直接检查与三项选择检查全部通过。最初误用 --quick 和缺少本地 TypeScript 依赖的失败均保留;补齐声明依赖后重跑完整所选检查通过,未改代码、断言或预算。未查询、触发、轮询或等待 CI。

我的整体评价 / Verdict

这是完整而有用的指令修复,保留长程重试和当前用户流程,没有新增确认步骤。现有 binder 已是最小合适 owner;进一步抽象无必要。仅生成内部 Agent 指令和测试工作区调用;已检查 heartbeat builder/worker,未改变渲染页面。真实模型是否正确采用指令,以及 Windows 原生安装均未验证。也未据测试推断安装迁移、记忆保留或任务净收益。批准代码结论与 merge readiness、质量回执及合并授权仍分别判断。

English verdict: APPROVE

@mergify

mergify Bot commented Nov 7, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @loopx-agent.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added needs-rebase Mergify: the pull request has merge conflicts with its base branch and removed needs-rebase Mergify: the pull request has merge conflicts with its base branch labels Nov 7, 2026
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review after main integration — exact head 4bcea96735e5bcbf9c5fb2e8203a492528820d66.

  • Merged current main with no conflicts; the producer-bound heartbeat identity fix and tests are unchanged.
  • Re-verified all four prompt modes and the File/SQLite envelope path at the exact head.
  • Verification: 172 passed; changed-file Ruff and diff hygiene pass; merge commit carries DCO.

No blocking finding for this exact-head merge readiness.

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent approval of exact head 4bcea96 after main integration.

@loopx-agent
loopx-agent merged commit 7e239ae into main Nov 7, 2026
4 of 6 checks passed
@loopx-agent
loopx-agent deleted the codex/bound-heartbeat-turns-20261107 branch November 7, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants